package com.naiterui.ehp.bs.consult.controller.inner;

import com.naiterui.ehp.bp.bo.consult.VideoConsultMessageBO;
import com.naiterui.ehp.bp.constants.SwaggerTag;
import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bs.consult.service.IVideoConsultMessageService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author luao
 * @date 2021/2/26 10:56 上午
 **/
@Slf4j
@RestController
@RequestMapping("/inner/video/consult/message")
@RequiredArgsConstructor
@Api(tags = SwaggerTag.VIDEO + SwaggerTag.INNER_API + SwaggerTag.VIDEO_CONSULT)
public class InnerVideoConsultMessageController {

    private final IVideoConsultMessageService videoConsultMessageService;

    /**
     * 添加视频咨询消息
     *
     * @param videoConsultMessageBO
     * @return
     */
    @PostMapping("/save")
    public VideoConsultMessageBO save(@RequestBody VideoConsultMessageBO videoConsultMessageBO) {
        return videoConsultMessageService.save(videoConsultMessageBO);
    }

    /**
     * 通过处方id获取视频消息记录
     * @param recomId
     * @return
     */
    @PostMapping("/getByRecomId")
    public VideoConsultMessageBO getByRecomId(@RequestParam Long recomId) throws BusinessException {
        log.info("通过处方id获取视频消息记录 recomId={}", recomId);
        return videoConsultMessageService.getByRecomId(recomId);
    }
}
